import 'dart:ffi' as ffi;
import 'dart:io';

// Note: We no longer depend on ffigen-generated N-API bindings here.

/// System-provided N-API shared library loader (libace_napi.z.so on OHOS).
class NapiSystemLib {
  NapiSystemLib._(this._dl);

  final ffi.DynamicLibrary _dl;

  static NapiSystemLib load() {
    if (Platform.isOhos || Platform.isAndroid || Platform.isLinux) {
      return NapiSystemLib._(ffi.DynamicLibrary.open('libace_napi.z.so'));
    }
    throw UnsupportedError('N-API system lib only available on OHOS/Android/Linux');
  }

  /// Expose the loaded DynamicLibrary for advanced lookups if needed.
  ffi.DynamicLibrary get dynamicLibrary => _dl;
}



